import React from 'react'
//1. 导入包
import PropTypes from 'prop-types';

export default function Stu(props) {
  //输出 props 参数
  // console.log(props);

  //解构赋值
  let {name, age, hobby} = props;

  return (
    <div>
      <p>姓名: {name}</p>
      <p>年龄: {age}</p>
      <p>爱好: {hobby.join('-')}</p>
    </div>
  )
}

//2. 为 Stu 设置 propTypes 属性
Stu.propTypes = {
  name: PropTypes.string,
  age: PropTypes.number,
  hobby: PropTypes.array
}

Stu.defaultProps = {
  name: '马尔扎哈'
}